/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { Queue } from '../../../../src/base/util/queue';

describe('test queue', () => {
  test('test queue push&pop', () => {
    const queue = new Queue();
    queue.push('aaa');
    queue.push('bbb');
    expect(queue.size()).toBe(2);

    const element = queue.pop();
    expect(element).toBe('aaa');
    expect(queue.size()).toBe(1);
    const queueFirstElement = queue.peek();
    expect(queueFirstElement).toBe('bbb');
    expect(queue.size()).toBe(1);
  });

  test('test queue toString', () => {
    const queue = new Queue();
    queue.push('aaa');
    queue.push('bbb');
    expect(queue.toString()).toBe('aaa,bbb');
  });
});
